﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using AWZhome.NQ.Core;

namespace AWZhome.NQ.CommonServices.Visual
{
	/// <summary>
	/// Interaction logic for AboutWindow.xaml.
	/// </summary>
	internal partial class AboutWindow : Window
	{
		public AboutWindow()
		{
			InitializeComponent();

			// Get the copyright of the core component
			INQComponentInfo coreComp = NQServiceManager.Instance.GetComponentInfo("NQCore");
			if (coreComp != null)
			{
				this.labelNQCopyright.Content = coreComp.Copyright;
			}

			// Set the ItemSource for component list
			List<INQComponentInfo> compList = new List<INQComponentInfo>();
			foreach (string compname in NQServiceManager.Instance.GetComponentList())
			{
				compList.Add(NQServiceManager.Instance.GetComponentInfo(compname));
			}

			listComponents.ItemsSource = compList;

			// Select first list item
			listComponents.SelectedIndex = 0;
		}

		private void Hyperlink_Click(object sender, RoutedEventArgs e)
		{
			// Navigate to the Hyperlink URI
			Hyperlink hyperlink = sender as Hyperlink;

			if (hyperlink != null)
			{
				System.Diagnostics.Process.Start(hyperlink.NavigateUri.ToString());
			}
		}
	}
}
